/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	深圳市国省检日常化监管系统         </p>
 * <p>创建者   :	hey 
 * 
 * <p>描   述  :   ReportChannelsSerrviceImpl.java for com.pengtu.gsj.service.impl.lzgl    </p>
 * 
 * <p>最后修改 : $: Sep 12, 2017-11:58:38 AM v 1.0.0	 hey   $ </p>
 * 
*/

package com.pengtu.gsj.service.impl.lzgl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.dao.lzgl.ReportChannelsDao;
import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.lzgl.ReportChannels;
import com.pengtu.gsj.service.lzgl.ReportChannelsService;
import com.pengtu.gsj.service.system.SystemManageService;

/**
 * 
 * ReportChannelsSerrviceImpl
 * 
 * Sep 12, 2017 11:58:38 AM
 * 
 * @version 1.0.0
 * 
 */
@Service
@Transactional
public class ReportChannelsServiceImpl implements ReportChannelsService{
	
	@Autowired
	private ReportChannelsDao reportChannelsDao;
	
	@Autowired
	private SystemManageService systemManageService;
	
	
	
	@Override
	public void saveReportChannels(ReportChannels reportChannels){
		reportChannelsDao.save(reportChannels);
	}
	
	@Override
	public Page<ReportChannels> findReportChannels(Page<ReportChannels> page, final QueryFilter queryFilter){
		return reportChannelsDao.findPage(page, queryFilter);
	}
	
	@Override
	public ReportChannels getReportChannelsById(String id){
		return reportChannelsDao.get(id);
	}
	
	@Override
	public void  delateReportChannels(ReportChannels reportChannels){
		if(reportChannels.getAttachments() != null){
			for(Attachment attachment : reportChannels.getAttachments()){
				systemManageService.deleteAttachment(attachment);
			}
		}
		reportChannelsDao.delete(reportChannels);
	}
	
	
	@Override
	public List<ReportChannels> getReportChannels(){
		return reportChannelsDao.getAllReportChannels();
	}
}
